<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
    <link href="../css/element.css" rel="stylesheet"/>
    <link href="../css/styleindex.css" rel="stylesheet"/>
    <style>
    .el-tabs__item.is-active{
      color: #058142;
    }.el-tabs__active-bar{
      background-color: #058142;
    }.el-tabs{
      background-color: #fff;
    }.x-ico-month .el-input__inner{
      border: 0;
      font-size: 1rem;
      text-align: center;
    }.el-input__prefix{
      display: none;
    }.el-tabs__content{
      background-color: #EFF0F4;
    }
    </style>
</head>
<body style="background:#EFF0F4;">

  <div class="mui-content">
    <div id="vm" class="x-examok" v-cloak>
      <div class="x-header-g" id="header">
        <a class="x-header-arrow" @click="api.closeWin()"></a>
        <div class="x-header-t">周会议</div>
      </div>
      <!--  -->
      <div class="x-ico-month">
        <el-date-picker v-model="cardsmonth" type="month" placeholder="选择月" @change="getmonth" format="yyyy 年 MM 月" value-format="yyyyMM" :editable="notkey"></el-date-picker>
      </div>
      <!--  -->
      <div class="" style="margin-top:1rem;">

        <template>
          <el-tabs v-model="activeName" @tab-click="handleClick" stretch="true">
            <el-tab-pane label="周会议流程" name="first">
              <!--  -->
              <div v-if="prodata!=''">
                <div class="x-pro-list" v-for="(item,index) in prodata" :key="item.key">
                  <div class="x-pro-top">会议{{index+1}}</div>
                  <div class="x-pro-row">
                    <div class="x-pro-label">会议时间:</div>
                    <div class="x-pro-input">
                      <el-input placeholder="请输入内容" v-model="item.f_times" :disabled="isfromindex"></el-input>
                    </div>
                  </div>
                  <div class="x-pro-row">
                    <div class="x-pro-label">主持人:</div>
                    <div class="x-pro-input">
                      <el-input placeholder="请输入内容" v-model="item.mc_username" :disabled="isfromindex"></el-input>
                    </div>
                  </div>
                  <div class="x-pro-row">
                    <div class="x-pro-label">参加人:</div>
                    <div class="x-pro-input">
                      <el-input placeholder="请输入内容" v-model="item.depts" :disabled="isfromindex"></el-input>
                    </div>
                  </div>
                  <div class="x-pro-row x-pro-rowblock">
                    <div class="x-pro-label">会议目标:</div>
                    <div class="x-pro-input x-wkme-desc">
                      <div v-for="(itemk,indexk) in item.target">{{indexk+1}}.{{itemk.content}}</div>
                    </div>
                  </div>
                  <div class="x-pro-row x-pro-rowblock">
                    <div class="x-pro-label">会议流程:</div>
                    <div class="x-pro-input x-wkme-desc">
                      <div v-for="(iteml,indexl) in item.procedure">{{indexl+1}}.{{iteml.content}}</div>
                    </div>
                  </div>
                </div>
              </div>
              <div class="x-nothing" v-else>
                还没有内容
              </div>
            </el-tab-pane>
            <el-tab-pane label="会议提案列表" name="second">
              <div class="x-inc-num">本月周会议列表</div>
              <template>
                <el-table :data="tableDatatwo" style="width: 100%">
                  <el-table-column label="序号" width="70" type="index"></el-table-column>
                  <el-table-column label="周会时间" min-width="120">
                    <template slot-scope="scope">
                      {{scope.row.f_times}}
                    </template>
                  </el-table-column>
                  <el-table-column label="会议提案" min-width="80">
                    <template slot-scope="scope">
                      <el-button type="text" size="mini" @click="api.openWin({name:'inmeetdesc',url:'./inmeetdesc.html',pageParam:{id:scope.row.id}})">查看</el-button>
                    </template>
                  </el-table-column>
                </el-table>
              </template>
            </el-tab-pane>
            <el-tab-pane label="行动计划列表" name="third">
              <div class="x-inc-num">本月周会议列表</div>
              <template>
                <el-table :data="tableDatatwo">
                  <el-table-column label="序号" width="70" type="index"></el-table-column>
                  <el-table-column label="周会时间" min-width="120">
                    <template slot-scope="scope">
                      {{scope.row.f_times}}
                    </template>
                  </el-table-column>
                  <el-table-column label="行动计划" min-width="80">
                    <template slot-scope="scope">
                      <el-button type="text" size="mini" @click="api.openWin({name:'inplandesc',url:'./inplandesc.html',pageParam:{id:scope.row.id}})">查看</el-button>
                    </template>
                  </el-table-column>
                </el-table>
              </template>
            </el-tab-pane>
          </el-tabs>
        </template>
      </div>
      <!--  -->
      <el-dialog :title="toasttitle" :visible.sync="edittoast" width="90%" center="true" close-on-click-modal="false" show-close="false">
        <span>{{toastcon}}</span>
      </el-dialog>
      <!--  -->
      <el-dialog title="" :visible.sync="edittoasttwo" width="90%" center="true" close-on-click-modal="false" show-close="false">
        <div class="x-pro-row">
          <!-- <div class="x-pro-label">添加文字：</div> -->
          <div class="x-pro-input">
            <el-input placeholder="请输入" v-model="textvalue" type="textarea" :rows="3" disabled="true"></el-input>
          </div>
        </div>
        <div class="x-pro-himg" :style="{'background-image':'url(' +input4+ ')','background-size':'cover','width':'6rem','height':'6rem','border-radius':'0.4rem','margin-top':'1rem'}" v-if="input4!=''" @click="imagebig = true"></div>
      </el-dialog>
      <img :src="input4" alt="" width="100%" v-if="imagebig" class="x-img-big" @click="imagebig = false">
    </div>
  </div>

  <script type="text/javascript" src="../script/vue.js"></script>
  <script type="text/javascript" src="../script/element.js"></script>
  <script type="text/javascript" src="../script/api.js"></script>
  <script type="text/javascript" src="../script/base.js"></script>
	<script>
apiready = function () {

  $api.fixStatusBar($api.byId('header'));
  api.addEventListener({
      name: 'addclasstrainplanok'
  }, function(ret, err) {
      vm.getdatatwo()
  });

    //
    var vm = new Vue({
      el:'#vm',
      data(){
        return{
          cardsmonth:'',
          activeName: 'first',
          tableData:[],
          tableDatatwo:[],
          istype:'0',
          tableDatayead:[],
          itemKey:'',
          notkey:false,
          edittoast:false,
          toasttitle:'',
          toastcon:'',
          edittoasttwo:false,
          textvalue:'',
          input4:'',
          prodata:[],//行动计划data
          perdata:'',
          isfromindex:true,
          entryworkindex:0,
          imagebig:false

        }
      },
      created:function() {
        var that=this;

      },
      mounted:function(){
        var that=this;
        //当前月份
        var date = new Date();
        var year = date.getFullYear();
        var month = date.getMonth()+1;
        if(month<10){
          month = '' + 0 + month;
        }
        var toMonth = '' + year + month;
        that.cardsmonth = toMonth;
        that.getperson()
        that.getdatafirst()

      },
      methods: {
        //
        getperson:function(){
          let that=this;
          api.ajax({
            url:baseurl+'api/person/list',
            methods:'get',
            data:{
              values:{
                sec: $api.getStorage('apptoken'),
                _ssid:$api.getStorage('jobid')
              }
            }
          },function(ret,err){
            if(ret){
              api.hideProgress();
              console.log(JSON.stringify(ret));
              if(ret.status == 1){
                that.perdata = ret.data.list;

              }else{
                api.toast({
                    msg: ret.msg,
                    duration: 3000,
                    location: 'bottom'
                });
              }
            }else{
              api.hideProgress();
              console.log(JSON.stringify(err));
              api.toast({
                  msg: err.msg,
                  duration: 3000,
                  location: 'bottom'
              });
            }
          })
        },
        //删除
        removeentrywork:function(index){
          let that = this;
          var nowin = index;
          console.log(JSON.stringify(that.prodata));
          api.confirm({
            title: '操作提示',
            msg: '确定要删除吗？',
            buttons: ['确定','取消']
          }, function(ret, err) {
            var index = ret.buttonIndex;
            if(index == 1){
              //删除
              that.prodata.splice(nowin,1);//删除全部数组中对应的值
              console.log(JSON.stringify(that.prodata));
            }
          });
        },
        //删除训练计划列表
        removelist:function(id){
          let that = this;
          api.confirm({
            title: '操作提示',
            msg: '确定要删除吗？',
            buttons: ['确定','取消']
          }, function(ret, err) {
            var index = ret.buttonIndex;
            if(index == 1){
              //删除
              that.goremovelist(id)
            }
          });
        },
        //删除训练计划列表ajax
        goremovelist:function(id){
          let that=this;
          api.ajax({
            url:baseurl+'api/meeting/delWeekTrain',
            methods:'get',
            data:{
              values:{
                sec: $api.getStorage('apptoken'),
                id:id,
                _ssid:$api.getStorage('jobid')
              }
            }
          },function(ret,err){
            if(ret){
              api.hideProgress();
              console.log(JSON.stringify(ret));
              if(ret.status == 1){
                api.toast({
                    msg: ret.msg,
                    duration: 3000,
                    location: 'bottom'
                });
                that.getdatatwo()
              }else{
                api.toast({
                    msg: ret.msg,
                    duration: 3000,
                    location: 'bottom'
                });
              }
            }else{
              api.hideProgress();
              console.log(JSON.stringify(err));
              api.toast({
                  msg: err.msg,
                  duration: 3000,
                  location: 'bottom'
              });
            }
          })
        },
        //继续添加
        goonentrywork:function(){
          var that = this;
          that.entryworkindex++
          that.prodata.push({
            'title':'',
            'step_str':'',
            'result_str':'',
            'finish_time':'',
            'liable_memberid':'',
            'tracker_memberid':'',
            'weekid':'',
            'index':that.entryworkindex,
          });
        },
        //提交行动计划
        isok:function(){
          var that = this;
          console.log(JSON.stringify(that.prodata));
          api.ajax({
            url:baseurl+'api/meeting/addWeekPlan',
            methods:'get',
            data:{
              values:{
                sec: $api.getStorage('apptoken'),
                plan_json:that.prodata,
                _ssid:$api.getStorage('jobid')

              }
            }
          },function(ret,err){
            if(ret){
              api.hideProgress();
              console.log(JSON.stringify(ret));
              if(ret.status == 1){
                api.alert({
                    title: '提交成功',
                    msg: '',
                }, function(ret, err) {

                });

              }else{
                api.toast({
                    msg: ret.msg,
                    duration: 3000,
                    location: 'bottom'
                });
              }
            }else{
              api.hideProgress();
              console.log(JSON.stringify(err));
              api.toast({
                  msg: err.msg,
                  duration: 3000,
                  location: 'bottom'
              });
            }
          })
        },
        //记录要点
        editfavo:function(title,content){
          var that = this;
          that.toasttitle = title;
          that.toastcon = content;
          that.edittoast = true;
        },
        //记录要点2,3
        editfavotwo:function(id,con,img,clearid){
          var that = this;
          that.textvalue = con;
          that.input4 = img;
          that.editid = id;
          that.clearid = clearid;
          that.edittoasttwo = true;

        },
        //月份
        getmonth:function(val){
          var that = this;
          console.log(val);
          that.cardsmonth = val;
          if(that.istype=='0'){
            that.getdatafirst()
          }else if(that.istype=='1'){
            that.getdatatwo()
          }else if(that.istype=='2'){
            that.getdatatwo()
          }

        },
        //选项卡
        handleClick(tab, event) {
          let id = event.target.getAttribute('id').split('-');
          let whitetab = id.join('').substring(3,9);
          let that = this;
          if(whitetab=='first'){//入职
            that.istype = '0';
            that.getdatafirst()
          }else if(whitetab=='second'){//离职
            that.istype = '1';
            that.getdatatwo()
          }else if(whitetab=='third'){//工龄
            that.istype = '2';
            that.getdatatwo()
          }
        },
        //入职
        getdatafirst:function(){
          let that=this;
          api.ajax({
            url:baseurl+'api/meeting/getWeekProcedure',
            methods:'get',
            data:{
              values:{
                sec: $api.getStorage('apptoken'),
                date:that.cardsmonth,
                _ssid:$api.getStorage('jobid')
              }
            }
          },function(ret,err){
            if(ret){
              api.hideProgress();
              console.log(JSON.stringify(ret));
              if(ret.status == 1){
                that.prodata = ret.data.list;

              }else{
                api.toast({
                    msg: ret.msg,
                    duration: 3000,
                    location: 'bottom'
                });
              }
            }else{
              api.hideProgress();
              console.log(JSON.stringify(err));
              api.toast({
                  msg: err.msg,
                  duration: 3000,
                  location: 'bottom'
              });
            }
          })
        },
        //离职
        getdatatwo:function(){
          let that=this;
          api.ajax({
            url:baseurl+'api/meeting/getWeek',
            methods:'get',
            data:{
              values:{
                sec: $api.getStorage('apptoken'),
                date:that.cardsmonth,
                _ssid:$api.getStorage('jobid')
              }
            }
          },function(ret,err){
            if(ret){
              api.hideProgress();
              console.log(JSON.stringify(ret));
              if(ret.status == 1){
                that.tableDatatwo = ret.data.list;

              }else{
                api.toast({
                    msg: ret.msg,
                    duration: 3000,
                    location: 'bottom'
                });
              }
            }else{
              api.hideProgress();
              console.log(JSON.stringify(err));
              api.toast({
                  msg: err.msg,
                  duration: 3000,
                  location: 'bottom'
              });
            }
          })
        },
        //工龄
        getdatathird:function(){
          let that=this;

        },
      }
    })
	}


	</script>
</body>
</html>
